<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="page" uri="http://www.forten.org/taglib/page"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="forten" uri="http://www.forten.org/taglib/forten"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>开课信息</title>
<!-- CSS -->
<link type="text/css" rel="stylesheet" href="../styles/css/reset.css">
<link type="text/css" rel="stylesheet" href="../styles/css/index.css">
<script type="text/javascript" src="../scripts/html5.js"></script>
<!-- end -->
<!-- jquery -->
<script type="text/javascript" src="../scripts/jquery-1.6.min.js"></script>
<!-- 日期控件 -->
<script type="text/javascript" src="../scripts/Calendar/Js/calendar.js"></script>
<link type="text/css" rel="stylesheet"
	href="../scripts/Calendar/Css/calendar.css" />
<!-- end -->
<!-- fancybox -->
<script>
	!window.jQuery
			&& document
					.write('<script src="../scripts/fancybox/jquery-1.4.3.min.js"><\/script>');
</script>
<script type="text/javascript"
	src="../scripts/fancybox/jquery.fancybox-1.3.4.pack.js" charset="utf-8"></script>
<link media="screen" type="text/css" rel="stylesheet"
	href="../scripts/fancybox/jquery.fancybox-1.3.4.css">
<!-- end -->
</head>

<body>
	<c:if test="${! empty message }">
		<script type="text/javascript" language="javascript">
			window.onload = function() {
				var message = "${message}";
				alert(message);
			}
		</script>
	</c:if>

	<script type="text/javascript">
		function doDelete(id,name) {
			if (confirm("您正在删除“"+name+"”的课程信息，确认继续吗？")) {
				window.location.href = "deleteCourse.jspx?id=" + id;
			} else {
				return false;
			}
		}
		
		function doDeleteCourseware(courseId,name){
			if (confirm("您正在删除“"+name+"”的所有附件信息，确认继续吗？")) {
				window.location.href = "deleteCourseware4Course.jspx?courseId=" + courseId;
			} else {
				return false;
			}
		}

		function doQuery() {
			var start = $('#start');
			var end = $('#end');
			if (start.val() == '' && end.val() != '') {
				alert('请选择您要查询上课时间的起始时间！');
			}
			document.frm.action = "showCourseList.jspx";
			document.frm.submit();
		}

		function doExport2003() {
			document.frm.action = "export2003.jspx";
			document.frm.submit();
		}

		function doExport2007() {
			document.frm.action = "export2007.jspx";
			document.frm.submit();
		}

		function doExport2003SignIn() {
			document.frm.action = "export2003SignIn.jspx";
			document.frm.submit();
		}

		function doExport2007SignIn() {
			document.frm.action = "export2007SignIn.jspx";
			document.frm.submit();
		}

		$(document).ready(function() {

			<c:forEach items="${dto }" var="dto" varStatus="s">
			$("#teacherInfo${s.index}").fancybox({
				'titlePosition' : 'inside',
				'transitionIn' : 'none',
				'transitionOut' : 'none'
			});
			$("#courseInfo${s.index}").fancybox({
				'titlePosition' : 'inside',
				'transitionIn' : 'none',
				'transitionOut' : 'none'
			});
			</c:forEach>
			$('<a href="#top" >返回顶部</a>').insertAfter('table');
			$('<a id="top" name="top"></a>').prependTo('body');
		});
	</script>

	<header>
	<div class="headerWrap"></div>
	</header>

	<div class="content">

		<section>
		<div class="rc_fbt">
			<form:form action="showCourseList.jspx" id="frm"
				modelAttribute="courseQo" name="frm">
				<span class="left"> <span class="ml15 mr5 left">上课时间从</span>
					<form:input path="start" class="s_txt left mt13"
						onclick="displayCalendar(this, 'yyyymmdd', this, false, '');"
						size="8" maxlength="8" readonly="true" /> <span
					class="ml15 mr5 left">至</span> <form:input path="end"
						class="s_txt left mt13"
						onclick="displayCalendar(this, 'yyyymmdd', this, false, '');"
						size="8" maxlength="8" readonly="true" /> <span
					class="mlr15 left">课程名</span> <form:input path="name"
						class="s_txt ml5 left mt13" /> <span class="mlr15 left">教师</span>
					<form:input path="teacherName" class="s_txt ml5 left mt13" /> <a
					class="btn_search ml10 left mt10" href="#" onclick="doQuery();"></a>
				</span>
				<p class="right">
					<a class="btn2 mt10" href="gotoCourseAdd.jspx"> <span>新增</span>
					</a> <a class="btn2 mt10" href="gotoUploadCourseData.jspx"
						target="_blank"> <span>导入</span>
					</a> <a class="btn2 mt10" href="export2003.jspx"> <span>导出03excel</span>
					</a> <a class="btn2 mt10" href="export2007.jspx"> <span>导出07excel</span>
					</a>
				</p>
			</form:form>
		</div>
		<div class="rc_info mt20">
			<h3>
				<span class="r_title_ico"></span> 已开课程信息
			</h3>
		</div>

		<table class="rc_tab01" cellspacing="0" cellpadding="0">
			<tbody>
				<tr>
					<th style="width: 6%; text-align: center;">课程号</th>
					<th style="width: 10%; text-align: center;">课程名</th>
					<th style="width: 6%; text-align: center;">教师</th>
					<th style="width: 10%; text-align: center;">上课时间</th>
					<th style="width: 8%; text-align: center;">上课地点</th>
					<th style="width: 5%; text-align: center;">课容量</th>

					<th style="width: 5%; text-align: center;">学时</th>
					<th style="width: 10%; text-align: center;">选课开始时间</th>
					<th style="width: 10%; text-align: center;">选课结束时间</th>
					<th style="width: 5%; text-align: center;">选课人数</th>
					<th style="width: 5%; text-align: center;">课件数</th>
					<th class="rc_cr" style="text-align: center; width: 10%;">操作</th>
				</tr>


				<c:forEach items="${dto }" var="dto" varStatus="s">
					<tr>
						<td style="text-align: center;">${dto.num }</td>
						<td style="text-align: center;"><a id="courseInfo${s.index }"
							href="#inline1${s.index }" title="课程简介">${dto.name }</a>
							<div style="display: none;">
								<div id="inline1${s.index }"
									style="width: 400px; height: 140px; overflow: auto; word-break: break-all; text-align: left;">
									<fieldset>${dto.courseInfo}</fieldset>
								</div>
							</div></td>
						<td style="text-align: center;"><a
							id="teacherInfo${s.index }" href="#inline2${s.index }"
							title="教师简介">${dto.teacherName }</a>
							<div style="display: none;">
								<div id="inline2${s.index }"
									style="width: 400px; height: 140px; overflow: auto; word-break: break-all; text-align: left;">
									<fieldset>${dto.teacherInfo}</fieldset>
								</div>
							</div></td>
						<td style="text-align: center;"><fmt:formatDate
								value="${dto.teachTime }" pattern="yyyy年MM月dd日HH点mm分" /></td>
						<td style="text-align: center;">${dto.classroom }</td>
						<td style="text-align: center;">${dto.classCapacity }</td>
						<td style="text-align: center;">${dto.credit }</td>
						<td style="text-align: center;"><fmt:formatDate
								value="${dto.startTimeChoose }" pattern="yyyy年MM月dd日HH点mm分" /></td>
						<td style="text-align: center;"><fmt:formatDate
								value="${dto.endTimeChoose }" pattern="yyyy年MM月dd日HH点mm分" /></td>
						<td style="text-align: center;"><c:if
								test="${dto.classChosenNum<0}">0</c:if> <c:if
								test="${dto.classChosenNum>=0}">${dto.classChosenNum}</c:if></td>
						<c:if test="${dto.coursewareQuantity==0}">
							<td style="text-align: center;">0</td>
						</c:if>
						<c:if test="${dto.coursewareQuantity>0}">
							<td style="text-align: center;">
							<a href="#" style="color: red" onclick="doDeleteCourseware('${dto.id}','${dto.name }');">${dto.coursewareQuantity}</a>
							</td>
						</c:if>
						<td class="rc_cr" style="text-align: center;"><a
							href="gotoCourseEdit.jspx?id=${dto.id }">编辑</a> &nbsp;|&nbsp; <a
							href="#" onclick="doDelete('${dto.id}','${dto.name }')">删除</a> &nbsp;|&nbsp; <a
							href="gotoUploadCourseware.jspx?courseId=${dto.id}"
							target="_blank">课件</a>&nbsp;|&nbsp;<a
							href="export2003SignIn.jspx?courseId=${dto.id}">签到表03</a>
							&nbsp;|&nbsp; <a href="export2007SignIn.jspx?courseId=${dto.id}">签到表07</a>
						</td>
					</tr>


				</c:forEach>
			</tbody>
		</table>
		<br>
		<page:page hrefStr="showCourseList.jspx" name="page"></page:page> </section>
		<!-- cont end -->
	</div>

	<%@include file="/common/foot.jsp"%>